home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1289 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.8 KB

  1. Path: montana.avicom.net!not-for-mail
  2. From: cts@montana.avicom.net (Craig Spannring)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: (HUGE) Help!  This bug is killing me!  Anyone have any ideas?
  5. Date: 9 Jan 1996 23:58:06 -0700
  6. Organization: Avicom
  7. Message-ID: <4cvo1u$sdv@montana.avicom.net>
  8. References: <4cjmbt$gaf@maverick.tad.eds.com>
  9. NNTP-Posting-Host: montana.avicom.net
  10.  
  11. In article <4cjmbt$gaf@maverick.tad.eds.com>,
  12. Darrin Smith <fignet05.darrins@eds.com> wrote:
  13. >Well I've spent 3 days now trying to figure out what is wrong with this 
  14. >thing, and I've finally decided to enlist YOUR help.
  15.  
  16. >*****************************************************************************
  17. >#include "dcmt.h"
  18. >
  19. >void main()
  20. >{
  21.  
  22. <253 lines deleted!!!>
  23.  
  24. >}
  25.  
  26. To start with I would question the wisdom of having 253 lines in this
  27. function.
  28.  
  29. <more lines deleted>
  30.  
  31. >    case 1 :
  32.  
  33. Don't use magic numbers in your code.  The people forced to maintain 
  34. this will start carrying voodoo dolls of you around with them.
  35.  
  36.  
  37.  
  38. >/* ##################### Text Function ################### */
  39. >text( char *textvar, int textfunc)
  40.  
  41. Use better function header comments.  In fact use better (and more)
  42. comments throughout the code.
  43.  
  44. Do a walkthrough (with pencil and paper) of your code before you try
  45. running it.  I know walkthroughs are an ancient technique, but they
  46. will find many coding errors.  (It probably won't find any
  47. specifications or requirements errors though.)
  48.  
  49. Get some tools like Bounds Checker, Purify, Code Guard, etc.  These
  50. programs cost a few bucks in the short term, but how much does each
  51. three day bug your company in salary, office space, lost time to
  52. market, etc?
  53.  
  54. Use the right tool for the job.  (No flames from C/C++ fans please.) It
  55. looks to me (at first glance anyhow) that this converts a source files
  56. from one format to another.  C/C++ might be a fine language for general
  57. purpose, but lex or something similar is specialized for your current
  58. task.
  59.  
  60. Try to get you company to require programmers and software engineers to
  61. learn good techniques for design, coding, and testing.  I don't just
  62. mean learning all the buzzwords like repeatable processes, TQM, and
  63. such, but really developing the skills needed to develop good
  64. software.  Looking at your sample of code makes it evident to me that
  65. your company doesn't require quality products.  Poor techniques
  66. guarantee poor software.
  67.  
  68. Read books like 'Writing Solid Code', 'Software Quality Assurance' and
  69. others.  Make an effort to apply techniques they offer. Learn from your
  70. mistakes.  Learn from the mistakes of others.
  71.  
  72. I guess I should step down from my soapbox now.
  73.  
  74. -- 
  75. ===========================================================================
  76.  Opinions expressed are soley mine and my cat's   | Craig Spannring
  77.  They do not represent the views of my employer.  | cts@avicom.net
  78.